package cn.xfdzx.android.apps.shop.activity;


import android.view.View;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import butterknife.BindView;
import cn.xfdzx.android.apps.shop.R;
import cn.xfdzx.android.apps.shop.adapter.AllCommentAdapter;
import cn.xfdzx.android.apps.shop.base.BaseMvpActivity;
import cn.xfdzx.android.apps.shop.bean.GoodsBeen;
import cn.xfdzx.android.apps.shop.view.WordWrapView;

public class AllCommentsActivity extends BaseMvpActivity {

    @BindView(R.id.wwv_view_type)
    WordWrapView wordWrapView;
    @BindView(R.id.rv_comment)
    RecyclerView rvComment;
    private ArrayList<String> list;
    private TextView single_textView;
    @Override
    public int getLayoutId() {
        return R.layout.activity_all_comments;
    }

    @Override
    public void initView() {
        list = new ArrayList<>();
        list.add("全部(9999+)");
        list.add("最新");
        list.add("好评(8050)");
        list.add("差评(80)");
        list.add("有图(566)");

        for (final String search_text : list) {

            final TextView textview = (TextView) View.inflate(this, R.layout.item_search_history, null);
            if (list.get(0).equals(search_text)) {
                single_textView = textview;
                single_textView.setBackgroundResource(R.drawable.comments_type_green_bg);
                single_textView.setTextColor(getResources().getColor(R.color.color_FFFFFF));
            }else {
                textview.setTextColor(getResources().getColor(R.color.color_A1A1A1));
                textview.setBackgroundResource(R.drawable.comments_type_hui_bg);
            }
            textview.setText(search_text);
             textview.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    single_textView.setTextColor(getResources().getColor(R.color.color_A1A1A1));
                    single_textView.setBackgroundResource(R.drawable.comments_type_hui_bg);
                    single_textView = textview;
                    single_textView.setBackgroundResource(R.drawable.comments_type_green_bg);
                    single_textView.setTextColor(getResources().getColor(R.color.color_FFFFFF));
                }
            });
            wordWrapView.addView(textview);
        }



        rvComment.setLayoutManager(new LinearLayoutManager(this));
        rvComment.setNestedScrollingEnabled(false);
        rvComment.setAdapter(new AllCommentAdapter(this,new ArrayList<GoodsBeen>()));
    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void onError(Throwable throwable) {

    }
}
